
package com.ruoyi.busi.guide.service.impl;

import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.ruoyi.busi.guide.domain.Ability;
import com.ruoyi.busi.guide.mapper.AbilityMapper;
import com.ruoyi.busi.guide.service.IAbilityService;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 导师能力Service业务层处理
 */
@Service
public class AbilityServiceImpl extends ServiceImpl<AbilityMapper, Ability> implements IAbilityService {

    private final AbilityMapper abilityMapper;

    public AbilityServiceImpl(AbilityMapper abilityMapper) {
        this.abilityMapper = abilityMapper;
    }

    @Override
    public Ability selectByMentorId(Long mentorId) {
        if (mentorId == null) {
            throw new IllegalArgumentException("导师ID不能为空");
        }
        return abilityMapper.selectByMentorId(mentorId);
    }

    @Override
    public List<Ability> selectByMinScore(String abilityType, Double minScore) {
        if (abilityType == null || abilityType.isEmpty()) {
            throw new IllegalArgumentException("能力类型不能为空");
        }
        if (minScore == null) {
            throw new IllegalArgumentException("最低分数不能为空");
        }
        return abilityMapper.selectByMinScore(abilityType, minScore);
    }

    @Override
    public boolean deleteAbilityByIds(List<Long> abilityIds) {
        if (abilityIds == null || abilityIds.isEmpty()) {
            throw new IllegalArgumentException("能力ID列表不能为空");
        }
        return this.removeByIds(abilityIds);
    }
}
